<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.tjsinfo.tjsoa.common.ToolKit"%>
<%@page import="com.tjsinfo.tjsoa.common.SessionUser"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.User"%>
<%
String path = request.getContextPath();
//String treePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/RQOAtree/";
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String nowSQL = ToolKit.getProperties("com/tjsinfo/tjsoa/mail/properties/systemResource.properties", this).getProperty("nowSQL");
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible"content="IE=9; IE=8; IE=7; IE=EDGE"> 
	<title>粮油集团办公自动化协作平台</title>
	<link href="<%=basePath %>style/txlz7.css" rel="stylesheet" type="text/css" />
	<link href="<%=basePath%>style/red.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment)
{
    Range.prototype.createContextualFragment = function(html)
    {
        var frag = document.createDocumentFragment(), 
        div = document.createElement("div");
        frag.appendChild(div);
        div.outerHTML = html;
        return frag;
    };
}
</script>
	<!-- 多系统树 开始 -->
	<script type="text/javascript" src="<%=basePath%>js/ie.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/png.js"></script>
	<style >
		#uploadList li {
			float:  left;
			margin-right:  10px;
			width: 100%
		}
		.silk-del{
        background-image:url(<%=basePath %>ajaxFramework/ext-2.1/shared/icons/fam/delete.gif) !important;
	</style>
	<!-- 多系统树 开始 -->
<link href="<%=basePath %>ajaxFramework/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath %>ajaxFramework/uploadify/css/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext/ext-all.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/init.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext/ux/ux-all.js"></script>	
<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery-1.5.1.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.form.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext/extension/window/window.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/global/validator.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/global/pageControl.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/uploadify/jquery.uploadify.min.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/uploadify/TsystemUpload.js"></script>
	<!-- <script type="text/javascript" src="<%=basePath %>js/common/fileUpload/ajaxfileupload.js"></script>-->
	<script type="text/javascript" src="<%=basePath %>js/common/fileUpload/ajaxFileZx.js"></script>
	<!-- <script type="text/javascript" src="<%=basePath %>js/common/system/singleuserinfocheckedtree.js"></script> -->
	<script type="text/javascript" src="<%=basePath %>js/common/system/selectusertreecheck.js"></script>
	<script type="text/javascript" src="<%=basePath%>FCKeditor/fckeditor.js"></script>
	<script type="text/javascript" src="<%=basePath %>email/js/email.js"></script>
	<script type="text/javascript" src="<%=basePath %>email/js/writemailfrom.js"></script>
	<%--
	<script type="text/javascript">
	
	function peopleTree(){
		//var win = singleuserinfocheckedtree(<%=nowSQL %>,<%=SessionUser.getUserId(request) %>);
		var win = singleuserinfocheckedtree(1);
		win.show();
		win.on("winsubmint",function(data){
			//document.getElementById('jubaorename').value = data.usernametext;
			//document.getElementById('jubaorenid').value = data.usertext;
			$("#jubaorename").val(data.usernametext);
			$("#jubaorenid").val(data.userid);	
			win.hide();
			//if(document.getElementById('writeName').value!=''){
			//	document.getElementById('jubaorename').value += ','+document.getElementById('writeName').value;
			//}
		});
	}
	</script>
	--%>
	<!-- 结束 -->

	<script type="text/javascript">
	//初始化方法
	function init(){
	  initselectusertreecheck();	  
	 // document.getElementById('jubaorename').value = data.usernametext;
	 // document.getElementById('jubaorenid').value = data.usertext;
	}
	//定义初始化程序
	window.onload = init;
	</script>
	<script type="text/javascript">
		var lianxiangvalue = '';
		var lianxiangzong = '';
		//var sendusers='';
		var shiji = '';
		
		function windowonload(){			
			//document.getElementById("rightindex").style.height = document.body.clientHeight;
			//document.getElementById("p_03").style.height = 390;
			//document.getElementById("p_80").style.width = document.body.clientWidth-132;
			//document.getElementById("tdindex").style.height = document.body.clientHeight-90;
			//document.getElementById("divindex").style.height = document.body.clientHeight-165;
		}
		
		function submitform(){
			//var checkbox2 = document.getElementsByName('uuuuuuu');
			//var length  = checkbox2.length;
			var uuuuuuu = document.getElementById('uuuuuuu').value;
			var contest= document.getElementById('contest').value;
			var title = document.getElementById('title').value;
			document.getElementById('lianxiangzong').value = Ext.get("_combobox").dom.value;
			//for(var a = 0; a<length; a++)
			//{
				//var check1 = checkbox2[a].value;
				//uuuuuuu += check1+",";	
			//}
			//if(uuuuuuu == ''){
			//	document.getElementById('uuuuuuu').value=Ext.get("_combobox").dom.value;
				//alert(uuuuuuu);
			//}else{
			//	document.getElementById('uuuuuuu').value = uuuuuuu.substring(0,uuuuuuu.length-1)+','+Ext.get("_combobox").dom.value;
				//alert(uuuuuuu);
			//}
			if(title == ''){
				Ext.MessageBox.alert('提示框','<nobr>请输入主题<nobr>');
				return;
			}else{
				document.getElementById('title').value = title.substring(0,title.length);
				document.form1.submit();
			}
		}
		
		function back()
		{
			history.back(-1);
		}
		function savedraf()
		{	
			
			var uuuuuuu = document.getElementById('uuuuuuu').value;
			var contest= document.getElementById('contest').value;
			var title = document.getElementById('title').value;	
			//alert(uuuuuuu);
			//alert(contest);
			//alert(title);
			//$("form[name=form1]").attr("action",url);
			//$("form[name=form1]").submit();
			document.form1.action="<%=basePath%>tjsinfo/tjsoa/mail/saveDraf.do";
			//alert(uuuuuuu);
			//alert(contest);
			//alert(title);
			document.form1.submit();
		}
		function clearinputtwo(_name,_id){
			$('#'+_name).attr('value','');
			$('#'+_id).attr('value','');
			$('#jubaorenInput').attr('value','');
			$('#writeName').attr('value','');
		}
		function changdiv(){
			// mail_right.scrollIntoView();
			// mail_right.scrollTop=mail_right.scrollHeight
		}
		
		//window.onload = function(){
			//initselectusercheck();
		//	document.getElementById("mail_right").style.height = document.body.clientHeight-60;
		//}
		
		Ext.onReady(function(){
        //Ext.QuickTips.init();
        
        // 格式化数据，数据也可采用json数据
		var ds = new Ext.data.JsonStore({
	 		fields:['userId','userName'],
	 		url:'<%=basePath %>tjsinfo/tjsoa/system/selectUserByName.do',
 			root: 'root'
	 	});
    
        var storeList = new Ext.form.ComboBox({        
            store: ds,
            valueField:'userId',     // option的值
            displayField: 'userName',//option的显示文本
            triggerAction: 'all',
            emptyText:'请选择',
            mode: 'local',
            selectOnFocus:true,
            renderTo:'show',
            width:235,
            id:'_combobox',
           hideTrigger:true
        });
        
        //取得option值函数
        function getVal(){
            //var val = storeList.getValue();//取得option值
           	lianxiangzong += Ext.get("_combobox").dom.value;
           	Ext.get("_combobox").dom.value = lianxiangzong;
           	//alert(storeList.value);
           	//shiji += storeList.value;
        }

        storeList.on('select', getVal);//当选择时触发该函数
        
        function lianxiang(){
        	if(lianxiangvalue!=Ext.get("_combobox").dom.value){
	        	ds.removeAll();
	            ds.proxy = new Ext.data.HttpProxy({url:encodeURI('<%=basePath %>tjsinfo/tjsoa/system/selectUserByName.do')});
	           	ds.reload({params:{userName:Ext.get("_combobox").dom.value}}); 
           		lianxiangvalue = Ext.get("_combobox").dom.value;
        	}
        }
        
        storeList.on('beforequery', lianxiang);//当选择时触发该函数
        //parent.iFrameHeight();
	});
		
	</script>
	<script language="javascript">
	if(document.addEventListener){//如果是Firefox
		document.addEventListener("onkeydown",fireFoxHandler, true);
	}else{
		document.attachEvent("onkeydown",ieHandler);
	}
	function fireFoxHandler(evt){
		//alert("firefox");
		if(evt.keyCode==13){
			submitform();
		}
	}
	function ieHandler(evt){
		//alert("IE");
		if(evt.keyCode==8){
			if(document.activeElement.id=='_combobox'){
				var _title = Ext.get("_combobox").dom.value;
				if(_title!=null && _title!=''){
					var a = _title.substring(_title.length-1,_title.length);
					if(a==';'){
						_title = _title.substring(0,_title.length-1);
						if(_title.indexOf(';')!=-1){
							Ext.get("_combobox").dom.value = _title.substring(0,_title.lastIndexOf(';')+2);
							lianxiangzong = Ext.get("_combobox").dom.value;
							
							shiji = shiji.substring(0,shiji.length-1);
							shiji = shiji.substring(0,shiji.lastIndexOf('@')+1);
						}else{
							Ext.get("_combobox").dom.value = '';
							lianxiangzong = '';
						}
					}
				}
			}
		}
	}
	</script>
	<!-- 执行上传文件操作的函数 -->
	<script type="text/javascript">
		var deleteFile;
		var alreadyUploadFile='';
		var uploadUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=uploader';
		var deteleFileUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=deleted';
	</script>
</head>
  
<body style="height:610px;">
  <div id="rightindex" style="height:610px;">
		<div id="mailcontent" > 
			<div id="mail_title">
                <ul></ul>
            </div>
            <div id="mail_left" style="height: 94%">
                <div class="p_01">
                    <a  href="<%=basePath %>tjsinfo/tjsoa/mail/emailReceivedList.do" class="a1"><img src="<%=basePath %>images/mailicon03.gif" /></a><a href="<%=basePath %>tjsinfo/tjsoa/mail/writemailfrom.do" class="a2"><img src="<%=basePath %>images/mailicon04.gif" /></a>
                </div>
              <h1>
                </h1>
                <div class="p_02">
                <ul>
                    <li class="l_01"><a href="<%=basePath %>tjsinfo/tjsoa/mail/emailReceivedList.do">收件箱</a></li>
                    <li class="l_02"><a href="<%=basePath %>tjsinfo/tjsoa/mail/emailDraftList.do">草稿箱</a></li>
                    <li class="l_03"><a href="<%=basePath %>tjsinfo/tjsoa/mail/selectEmaiList.do">已发送</a></li>
                    <li class="l_04"><a href="<%=basePath %>tjsinfo/tjsoa/mail/deleteEmaiList.do">已删除</a></li>
                    <c:forEach var="fold" items="${foldlist}">
                    <li class="l_05"><a href="<%=basePath%>tjsinfo/tjsoa/mail/selectfoldemail.do?id=${fold.folderId}">${fold.folderName}</a></li>
                    </c:forEach>            
                </ul>
                </div>
                <div class="p_03">
                    <div class="s01">
                      <table width="100%" border="0" cellspacing="0">
                        <tr>
                          <td height="25"><strong></strong></td>
                        </tr>
                        <tr>
                          <td height="25"></td>
                        </tr>
                        <tr>
                          <td height="25"></td>
                        </tr>
                      </table>
                    </div>
                </div>
            </div>
		<form name="form1" action="<%=basePath %>tjsinfo/tjsoa/mail/writemail.do" method="post" id="form1" >
            <div id="mail_right" style="height: 98%" >
             <div class="p_11" style="width:99%">
                <ul>
                    <li class="s01"><a href="javascript:submitform()">发送</a></li>
                    <li class="s02"><a href="javascript:savedraf()">存草稿</a></li>
                     <li class="s04"><a href="javascript:back()">取消</a></li>                   
                </ul>
	          </div>
             <div class="p_80"style="height: 99%">
              <table width="98%" border="0" cellspacing="0" align="left">
                <tr>
                  <td width="5px;">
                  	<!-- <a href="javascript:selectusercheckwinshow('jubaorenid','jubaorename','node')" > -->
                  	<a>
                  		<img src="<%=basePath %>images/m_icon118.gif" width="67" height="22" />
                  	</a>
                  </td>
                  <td  width="550px">
                 	 <table cellpadding="0" cellspacing="0">
                 	 	<tr>
                  		<td width="250px" align="left"><div id="show" style="width: 200px"></div></td>
                  		<td><input name="uuuuuuu" id="uuuuuuu" size="30" style="height: 17px;width: 300px;margin-bottom: 0px" readonly="readonly">
                  		<input type="hidden" id="sendusers" name="sendusers"/></td>
                  		</tr>
                  	</table>
        		</td>
        		<td>
                  	<a href="javascript:void(0)" onclick="selectusertreecheckwinshow('sendusers','uuuuuuu','node')">菜单树选择</a>&nbsp;&nbsp;
                  	<a href="javascript:clearinputtwo('uuuuuuu','sendusers')">清空菜单树</a> 
                  </td>
                </tr>
                <tr>
                  <td width="5px;">
                  	<img src="<%=basePath %>images/m_icon211.gif" width="67" height="22" />
                  </td>
                  <td colspan="2">
                  	&nbsp;&nbsp;<input name="title" id="title" size="30" maxlength="20" style="height:17px;width:500px; margin-bottom:0px"/>
                  </td>
                </tr>
                <tr>
					<td width="5px;">
	                  	<img src="<%=basePath %>images/m_icon212.gif" width="67" height="21" />
	                </td>
	                <td width="250px" colspan="2">
	                	<table cellpadding="0" cellspacing="0">
	                	<tr><td align="left" class="value" id="filediv">
	                	<span><input type="file" UNSELECTABLE="on"  name="uploadFile" id="uploadFile" size="34" class="textinput" style="margin-bottom:0px" /></span>
	                	</tr>
	                	</table>
	                </td>
                </tr>
                <tr>
                  <td colspan="3"><textarea name="contest" id="contest"
						style="width: 100%; height: 605px;"></textarea>
						<script type="text/javascript">
						var oFCKeditor = new FCKeditor( 'contest' ) ;
						oFCKeditor.BasePath = 'FCKeditor/' ;
						oFCKeditor.ToolbarSet = 'Zoa' ;
						oFCKeditor.Width = '98%' ;
						oFCKeditor.Height = '420px' ;
						oFCKeditor.Value = '' ;
						oFCKeditor.ReplaceTextarea(); 
						//oFCKeditor.Create() ;
                        </script>
				  </td>
                </tr>
              </table>
            </div> 
            </div>
            
            <input  type="hidden" name="panduan" id="panduan"/>
            <input  type="hidden" name="sendid" id="jubaorenid"/>
            <input  type="hidden" name="sendInput" id="jubaorenInput"/>
            <input  type="hidden" name="writeName" id="writeName"/>
			<input  type="hidden" name="chaosongid" id="chaosongid"/>
			<input  type="hidden" name="misongid" id="misongid"/>
			<input  type="hidden" name="fujianname1" id="fujianname1"/>
			<input  type="hidden" name="node" id="node"/>
			<input  type="hidden" name="lianxiangzong" id="lianxiangzong"/>
			<input id="basePath" value="<%=basePath%>" type="hidden"/> 
            <div id="files" style="display: none;"></div>
		</form>
   </div>
</div>
<form action="" name="form2" method="post">
</form>
  </body>
</html>
